//
//  YCTrianingCell.m
//  YCSchool
//
//  Created by Kylin on 16/5/3.
//  Copyright © 2016年 yanglinxia. All rights reserved.
// 自定义专项训练的collectionViewCell

#import "YCTrainingCell.h"

@interface YCTrainingCell()
/**图片容器*/
@property(nonatomic,weak)UIImageView *imageView;
/**标题*/
@property(nonatomic,weak)UILabel *Celltitle;

@end


@implementation YCTrainingCell
- (void)setTitle:(NSString *)title{
    _title = title;
    _Celltitle.text = title;
}

- (void)setImage:(NSString *)image{
    _image = image;
    _imageView.image = [UIImage imageNamed:image];
    
}

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setupChildView];
    }
    return self;
}


// 添加子控件
- (void)setupChildView{
    
    // 添加图片
    UIImageView *imageView = [[UIImageView alloc]init];
    [self.contentView addSubview:imageView];
    _imageView = imageView;

    UILabel *Celltitle = [[UILabel alloc]init];
    Celltitle.textColor = [UIColor yc_colorWithUInt:0x808080];
    Celltitle.font = [UIFont systemFontOfSize:12];
    [self.contentView addSubview:Celltitle];
    _Celltitle = Celltitle;
    
    [imageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView).offset(27);
        make.top.equalTo(self.contentView).offset(12);
        make.width.equalTo(@40);
        make.height.equalTo(@40);
        
    }];
    
    [Celltitle mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(imageView.mas_bottom).offset(4);
        make.height.equalTo(@12);
        make.centerX.equalTo(imageView);
    }];

}
@end
